package com.ymatou.query.trading.api.testcase;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.query.trading.api.parameter.GetComplaintedOrderListBean;
import com.ymatou.query.trading.api.service.GetComplaintedOrderListCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymt.utils.tag.P3;
import com.ymttest.utils.constant.ECode;

/**
 * 查询买家投诉维权订单列表 FreeMaker Template自动生成代码
 */
@TestSuite
public class Ts_GetComplaintedOrderList {
	private static GetComplaintedOrderListBean colbean;
	private static GetComplaintedOrderListCall colcall;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("查询买家投诉维权订单列表");
	}

	@Before
	public void caseUp() {
		colbean = new GetComplaintedOrderListBean();
		colcall = new GetComplaintedOrderListCall();

	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(colcall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetComplaintedOrderList_001() {
		Logger.start(true,"查询买家投诉维权订单列表成功");
		try {
			// int BuyerId = 1113; //alpha数据
			int BuyerId = 400020;
			Logger.comment("买家Id:" + BuyerId);
			colbean.setBuyerId(BuyerId);
			int CurrentPageNum = 1;
			Logger.comment("CurrentPageNum:" + CurrentPageNum);
			colbean.setCurrentPageNum(CurrentPageNum);
			int PageSize = 2;
			Logger.comment("PageSize:" + PageSize);
			colbean.setPageSize(PageSize);
			// 发送请求
			colcall.setData(colbean);
			colcall.callService();
			Logger.comment("colcall send:" + colcall.getEntityString());
			Logger.comment("colcall response:" + colcall.getReturnData());
			Logger.verifyEquals(ECode.SUCCESS, colcall.getCode(), "验证Code");
			// Logger.verifyEquals(ErrorCode.SUCCESSMSG2, colcall.getMsg(),
			// "验证Msg");
			Logger.verifyEquals(true, colcall.getAllRecordCount() > 0, "验证查询条数");
			Logger.verifyEquals(PageSize, colcall.getOrderInfoList().size(), "验证当前页数显示的行数");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_GetComplaintedOrderList_002() {
		Logger.start(true,"用户不存在");
		try {
			// int BuyerId = 1113; //alpha数据
			int BuyerId = 1;
			Logger.comment("买家Id:" + BuyerId);
			colbean.setBuyerId(BuyerId);
			int CurrentPageNum = 1;
			Logger.comment("CurrentPageNum:" + CurrentPageNum);
			colbean.setCurrentPageNum(CurrentPageNum);
			int PageSize = 2;
			Logger.comment("PageSize:" + PageSize);
			colbean.setPageSize(PageSize);
			// 发送请求
			colcall.setData(colbean);
			colcall.callService();
			Logger.comment("colcall send:" + colcall.getEntityString());
			Logger.comment("colcall response:" + colcall.getReturnData());
			Logger.verifyEquals(ECode.SUCCESS, colcall.getCode(), "验证Code");
			// Logger.verifyEquals(ErrorCode.SUCCESSMSG2, colcall.getMsg(),
			// "验证Msg");
			Logger.verifyEquals(0, colcall.getAllRecordCount(), "验证查询条数");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_GetComplaintedOrderList_003() {
		Logger.start(true,"用户为空");
		try {
			// int BuyerId = 1113; //alpha数据
			int BuyerId = 1;
			Logger.comment("买家Id:" + BuyerId);
			// colbean.setBuyerId(BuyerId);
			int CurrentPageNum = 1;
			Logger.comment("CurrentPageNum:" + CurrentPageNum);
			colbean.setCurrentPageNum(CurrentPageNum);
			int PageSize = 2;
			Logger.comment("PageSize:" + PageSize);
			colbean.setPageSize(PageSize);
			// 发送请求
			colcall.setData(colbean);
			colcall.callService();
			Logger.comment("colcall send:" + colcall.getEntityString());
			Logger.comment("colcall response:" + colcall.getReturnData());
			Logger.verifyEquals(ECode.ERROR400, colcall.getCode(), "验证Code");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_GetComplaintedOrderList_004() {
		Logger.start(true,"当前页数为空");
		try {
			// int BuyerId = 1113; //alpha数据
			int BuyerId = 400020;
			Logger.comment("买家Id:" + BuyerId);
			colbean.setBuyerId(BuyerId);
			int CurrentPageNum = 1;
			// colbean.setCurrentPageNum(CurrentPageNum);
			int PageSize = 2;
			Logger.comment("PageSize:" + PageSize);
			colbean.setPageSize(PageSize);
			// 发送请求
			colcall.setData(colbean);
			colcall.callService();
			Logger.comment("colcall send:" + colcall.getEntityString());
			Logger.comment("colcall response:" + colcall.getReturnData());
			Logger.verifyEquals(ECode.ERROR400, colcall.getCode(), "验证Code");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_GetComplaintedOrderList_005() {
		Logger.start(true,"每页数量为空");
		try {
			// int BuyerId = 1113; //alpha数据
			int BuyerId = 400020;
			Logger.comment("买家Id:" + BuyerId);
			colbean.setBuyerId(BuyerId);
			int CurrentPageNum = 1;
			colbean.setCurrentPageNum(CurrentPageNum);
			int PageSize = 2;
			// colbean.setPageSize(PageSize);
			// 发送请求
			colcall.setData(colbean);
			colcall.callService();
			Logger.comment("colcall send:" + colcall.getEntityString());
			Logger.comment("colcall response:" + colcall.getReturnData());
			Logger.verifyEquals(ECode.ERROR400, colcall.getCode(), "验证Code");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetComplaintedOrderList_006() {
		Logger.start(true,"查询最后一页订单列表成功");
		try {
			// int BuyerId = 1113; //alpha数据
			int BuyerId = 400020;
			Logger.comment("买家Id:" + BuyerId);
			colbean.setBuyerId(BuyerId);
			int CurrentPageNum = 3;
			Logger.comment("CurrentPageNum:" + CurrentPageNum);
			colbean.setCurrentPageNum(CurrentPageNum);
			int PageSize = 30;
			Logger.comment("PageSize:" + PageSize);
			colbean.setPageSize(PageSize);
			// 发送请求
			colcall.setData(colbean);
			colcall.callService();
			Logger.comment("colcall send:" + colcall.getEntityString());
			Logger.comment("colcall response:" + colcall.getReturnData());
			Logger.verifyEquals(ECode.SUCCESS, colcall.getCode(), "验证Code");
			Logger.verifyEquals(true, colcall.getAllRecordCount() > 0, "验证查询条数");
			Logger.verifyEquals((colcall.getAllRecordCount() - PageSize * (CurrentPageNum - 1)), colcall
					.getOrderInfoList().size(), "验证当前页数显示的行数");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetComplaintedOrderList_007() {
		Logger.start(true,"查询第一页已经全部显示");
		try {
			// int BuyerId = 1113; //alpha数据
			int BuyerId = 400020;
			Logger.comment("买家Id:" + BuyerId);
			colbean.setBuyerId(BuyerId);
			int CurrentPageNum = 2;
			Logger.comment("CurrentPageNum:" + CurrentPageNum);
			colbean.setCurrentPageNum(CurrentPageNum);
			int PageSize = 82;
			Logger.comment("PageSize:" + PageSize);
			colbean.setPageSize(PageSize);
			// 发送请求
			colcall.setData(colbean);
			colcall.callService();
			Logger.comment("colcall send:" + colcall.getEntityString());
			Logger.comment("colcall response:" + colcall.getReturnData());
			Logger.verifyEquals(ECode.SUCCESS, colcall.getCode(), "验证Code");
			Logger.verifyEquals(true, colcall.getAllRecordCount() > 0, "验证查询条数");
			Logger.verifyEquals(0, colcall.getOrderInfoList().size(), "验证当前页数显示的行数");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}